From fe1b698e4a6bba7783edcb3d0431e6acb24323f4 Mon Sep 17 00:00:00 2001
From: Jean-Louis Dupond <jean-louis@dupond.be>
Date: Sun, 22 Apr 2012 23:08:47 +0200
Subject: [PATCH] Also handle GDK_SCROLL_SMOOTH

---
 remmina-plugins/rdp/rdp_event.c         |    9 +++++++++
 remmina-plugins/vnc/vnc_plugin.c        |   12 ++++++++++++
 remmina/src/remmina_connection_window.c |   14 ++++++++++++++
 3 files changed, 35 insertions(+)

diff --git a/remmina-plugins/rdp/rdp_event.c b/remmina-plugins/rdp/rdp_event.c
index de8e01f..3d3e67a 100644
--- a/remmina-plugins/rdp/rdp_event.c
+++ b/remmina-plugins/rdp/rdp_event.c
@@ -377,6 +377,15 @@ static gboolean remmina_rdp_event_on_scroll(GtkWidget* widget, GdkEventScroll* e
 		case GDK_SCROLL_DOWN:
 			flag = PTR_FLAGS_WHEEL | PTR_FLAGS_WHEEL_NEGATIVE | 0x0088;
 			break;
+		
+		case GDK_SCROLL_SMOOTH:
+			if (event->delta_y < 0)
+				flag = PTR_FLAGS_WHEEL | 0x0078;
+			if (event->delta_y > 0)
+				flag = PTR_FLAGS_WHEEL | PTR_FLAGS_WHEEL_NEGATIVE | 0x0088;
+			if (!flag)
+				return FALSE;
+			break;
 
 		default:
 			return FALSE;
diff --git a/remmina-plugins/vnc/vnc_plugin.c b/remmina-plugins/vnc/vnc_plugin.c
index 0321057..f000ccb 100644
--- a/remmina-plugins/vnc/vnc_plugin.c
+++ b/remmina-plugins/vnc/vnc_plugin.c
@@ -1426,6 +1426,18 @@ static gboolean remmina_plugin_vnc_on_scroll(GtkWidget *widget, GdkEventScroll *
 		case GDK_SCROLL_RIGHT:
 			mask = (1 << 6);
 			break;
+		case GDK_SCROLL_SMOOTH:
+			if (event->delta_y < 0)
+				mask = (1 << 3);
+			if (event->delta_y > 0)
+				mask = (1 << 4);
+			if (event->delta_x < 0)
+				mask = (1 << 5);
+			if (event->delta_x > 0)
+				mask = (1 << 6);
+			if (!mask)
+				return FALSE;
+			break;
 		default:
 			return FALSE;
 	}
diff --git a/remmina/src/remmina_connection_window.c b/remmina/src/remmina_connection_window.c
index dfcc353..5487697 100644
--- a/remmina/src/remmina_connection_window.c
+++ b/remmina/src/remmina_connection_window.c
@@ -1477,6 +1477,20 @@ static gboolean remmina_connection_holder_toolbar_scroll(GtkWidget* widget, GdkE
 				return TRUE;
 			}
 			break;
+		case GDK_SCROLL_SMOOTH:
+			if (event->delta_y < 0 && opacity > 0)
+                        {
+                                remmina_file_set_int(cnnobj->remmina_file, "toolbar_opacity", opacity - 1);
+                                remmina_connection_holder_update_toolbar_opacity(cnnhld);
+                                return TRUE;
+                        }
+			if (event->delta_y > 0 && opacity < TOOLBAR_OPACITY_LEVEL)
+                        {
+                                remmina_file_set_int(cnnobj->remmina_file, "toolbar_opacity", opacity + 1);
+                                remmina_connection_holder_update_toolbar_opacity(cnnhld);
+                                return TRUE;
+                        }
+                        break;
 		default:
 			break;
 	}
-- 
1.7.10

